import type { deviceDTO } from '@/props/device'
import requests from '@/utils/request'
export const getAllDevices = (roomId:number) => {
  return requests.get(`/feng/device/${roomId}`)
}

// export const addDevice = ({deviceName,roomId}) => {
//   return requests.post('/feng/device/addDevice',{

//   })
// }

export const getAirConditioner = (deviceId:number) => {
  return requests.get(`/feng/airConditioner/${deviceId}`)
}


export const setDeviceStatus = (deviceId:number,status:number) => {
  return requests.put('/feng/device/status2',{
    deviceId,
    status
  })
}


export const setTemperature = (airConditionerId:number,airConditionerTemperature:number) => {
  return requests.put('/feng/airConditioner',{
    airConditionerId,
    airConditionerTemperature
  })
}
export const setSpeed = (airConditionerId:number,speed:number) => {
  return requests.put('/feng/airConditioner',{
    airConditionerId,
    speed
  })
}


export const addDevice = ({deviceName,roomId,roomDeviceId,deviceRequestPath,deviceType,identificationCode}:deviceDTO) => {
  return requests.post('/feng/device/addDevice',{
    deviceName,
    roomId,
    roomDeviceId,
    deviceRequestPath,
    deviceType,
    identificationCode
  })
}

export const deleteDevice = (deviceId:number,deviceType:number) => {
  return requests.delete(`/feng/device/delDevice/${deviceId}/${deviceType}`)
}
